﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Windows.Data;

namespace Ellanet.Converters
{
    public class IntToImageSourceListConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Int32 i;

            if (!String.IsNullOrEmpty(value.ToString()) && Int32.TryParse(value.ToString(), out i) && (i > 0))
            {
                Debug.WriteLine(value.ToString());
                return (from Char c in i.ToString().ToCharArray() select String.Format("/Resources/{0}_Purple.png", c)).ToList();
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
